package com.digtime.adapter;

import com.digtime.adapter.impl.Mp4Player;
import com.digtime.adapter.impl.VlcPlayer;

/**
 * @author: kaiyi
 * @Date 2020/11/22 15:50
 */
public class MediaAdapter implements MediaPlayer{

    public AdvancedMediaPlayer advancedMediaPlayer;

    public MediaAdapter(String audioType){
        if(audioType.equalsIgnoreCase("vlc")){
            advancedMediaPlayer = new VlcPlayer();
        } else if(audioType.equalsIgnoreCase("mp4")){
            advancedMediaPlayer = new Mp4Player();
        }
    }

    @Override
    public void play(String audioType, String fileName) {
        if(audioType.equalsIgnoreCase("vlc")){
            advancedMediaPlayer.playVlc(fileName);
        }else if(audioType.equalsIgnoreCase("mp4")){
            advancedMediaPlayer.playMp4(fileName);
        }
    }
}
